package com.naiterui.ehp.bs.patient.controller;

import com.naiterui.ehp.bp.bo.cms.AgreementBO;
import com.naiterui.ehp.bp.constants.SwaggerTag;
import com.naiterui.ehp.bp.support.exception.BusinessException;
import com.naiterui.ehp.bs.patient.feign.CmsFeginClient;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 协议管理
 *
 * @author yangfuya
 * @since 2021/10/12
 */
@Slf4j
@Api(tags = SwaggerTag.PATIENT + SwaggerTag.AGREEMENT)
@AllArgsConstructor
@RestController
@RequestMapping("/ap/agreement")
public class ApAgreementController {
    private final CmsFeginClient cmsFeginClient;

    @ApiOperation(value = "协议详情", notes = "获取隐私协议等协议文件内容html格式文案")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "type", value = "协议类型(1:服务协议, 3:执业医师多点执业协议书, 4:隐私政策, 5:服务协议, 6:互联网问诊知情同意书, 7:发布条款, 8:风险提示告知书, 9:经纪人协议)", example = "1", dataType = "String", paramType = "path", required = true),
    })
    @GetMapping("/{type}")
    public AgreementBO getByType(@PathVariable("type") String type) throws BusinessException {
        return cmsFeginClient.getByType(type);
    }

}
